// 导入 mongoose
const mongoose = require('mongoose')

// 定义模型
const roleSchema = new mongoose.Schema({
  role_id: {
    type: Number,
    required: true
  },
  role_name: {
    type: String,
    required: true
  },
  router_ids: {
    type: Array,
    required: true
  },
  router_desc: {
    type: Array,
    required: true
  },
  role_desc: {
    type: String,
    required: true
  }
})
// 创建模型对象
// 模型对象是对文档操作的封装对象
const RoleModel = mongoose.model('role', roleSchema)

// 暴露模型对象
module.exports = RoleModel
